<template>
    <div>
        <el-container>

            <el-main>
                <el-container class="parent-body">
                    <el-header class="content-header">
                        <div><i class="el-icon-s-fold"></i> 数据列表</div>
                        <div>
                            <el-button @click="addOrder()">添 加</el-button>
                        </div>
                    </el-header>
                    <el-main class="info-main padding-style">
                        <el-table :data="tableData"  border style="width: 100%">
                            <el-table-column prop="msName" label="等级名称" width="150"></el-table-column>
                            <el-table-column label="默认会员等级" width="160">
                                <template slot-scope="scope"><el-switch  :active-value="1"
                      :inactive-value="0"
                       v-model="scope.row.msDefaultMember"></el-switch></template>
                            </el-table-column>
                            <el-table-column prop="msGrowthvalue" label="成长值满足点"> </el-table-column>
                            <el-table-column prop="msFreeshipping" label="免运费标准"></el-table-column>
                            <el-table-column prop="msAward" label="评价奖励"> </el-table-column>
                            <el-table-column prop="msRemark" label="备注"> </el-table-column>
                            <el-table-column label="操作">
                                <template slot-scope="scope">
                                    <el-button  size="mini" @click="exportOrder(scope.$index, scope.row)">编辑</el-button>
                                    <el-button  size="mini" @click="deleteOrder(scope.$index, scope.row)">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                    </el-main>
                </el-container>
            </el-main>
        </el-container>

    </div>
</template>

<script>
import settingApi from "@/api/user/mbsetting";
    export default {
        data() {
            return {
                tableData: []
            }
        },
        methods:{
        addOrder(){
  this.$router.push({ path: "/user/addMemberSetting"});

        },
            exportOrder(index, row){
                 this.$router.push({
        path: "/user/updateMember",
        query: { msId: row.msId }
      });
            
            },
            deleteOrder(index,row){
                settingApi.deleteById(row.msId).then(response => {
        console.log(response);
      this.$router.go(0); 
      
      });
            },

            inData(){
                settingApi.getListAll().then(response => {
        console.log(response);
        this.tableData=response.data.data;
      
      });
            }
        },
        mounted(){
            this.inData();
        }
    }
</script>

<style scoped>
    .badges {
        height: 60px;
        padding: 10px;
    }
    .common-home,.content-header{
        border-bottom:1px solid #E4E4E4;
        position: relative;
    }
    .common-home>div{
        display: inline-block;
        width:100px;
        height:50px;
        vertical-align: top;
        text-align: center;
        line-height: 50px;
        color:#666666;
    }
    .common-home>.refresh{
        position: absolute;
        right:10px;
    }
    .common-home>div>span{
        border:4px solid #0399FE;
        display: inline-block;
        width: 0px;
        height: 15px;
        vertical-align: middle;
        margin-right: 5px;
        background-color: #0399FE;
    }
    .parent-body{
        border:1px solid #E4E4E4;
    }
    .content-header{
        height:50px;
        line-height: 50px;
        background-color:#F3F3F3;
        color:#666666;
        position: relative;
        text-align: left;
    }
    .info-main{
        background-color:#fff;
    }

    .content-header>div{
        display: inline-block;
    }
    .content-header>div:last-of-type{
        position: absolute;
        right:10px;
    }
    .input-width{
        width:200px;
    }
    .select-div{
        display: inline-block;
        width:300px;
    }
    .input-width2{
        width:120px;
    }
    .input-width3{
        width:400px;
    }
    .padding-style{
        padding:0 !important;
    }

    .info-foot{
        background-color:#FDFDFE;
        height:60px;
        line-height: 60px;
        position: relative;
    }
    .paging-style{
        position: absolute;
        right:10px;
        display: inline-block;
        top:15px;
    }
    .margin-left{
        margin-left:10px;
    }
    .search-style{
        width:50%;
        display: inline-block;
        vertical-align: top;
    }
</style>

